package com.boyunv.chainduty.example03;
/*
 *@description
 * 抽象审核链类
 *@author boyunv
 *@create 2023/8/26 13:25
 *@version 1.0
 */

import com.boyunv.chainduty.example02.AuthInfo;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.text.SimpleDateFormat;
import java.util.Date;

public abstract class AuthLink {
    
    protected Logger logger=LoggerFactory .getLogger(AuthLink.class);
    
    protected SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    
    protected  String levelUserId;  //审核人ID
    
    protected String  levelUserName;//审核人姓名
    
    @Getter
    protected  AuthLink next;//表示持有下一个处理对象的的引用
    
    //向责任链中添加处理器
    public AuthLink appendNext(AuthLink next){
        this.next=next;
        return this;
    }
    
    public AuthLink(String levelUserId, String levelUserName) {
        this.levelUserId = levelUserId;
        this.levelUserName = levelUserName;
    }
    
    //抽象的审核方法
    public abstract  AuthInfo doAuth(String uId, String orderId, Date authDate);
}
